﻿@{
    ViewBag.Title = "NgTable";
}

@section css{
<link href="~/Scripts/Home/ngtable.css" rel="stylesheet" />
}

@section scripts{
<script src="~/Scripts/angular.js"></script>
<script src="~/Scripts/Home/ngtable.js"></script>
}

<div class="row" ng-app="ngtable">
    <div ng-controller="firstCtrl">
        <form class="col-md-12">
            <textarea class="form-control" rows="5">{{buttons}}</textarea>
        </form>

        <div class="row">
            <div class="col-md-12">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>标题</th>
                        <th>类型</th>
                        <th>颜色</th>
                        <th>内容</th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="b in buttons">
                        <td><input class="form-control" type="text" ng-model="b.title"/></td>
                        <td>
                            <select class="form-control" ng-model="buttons[$index].type" ng-change="changeType($index)">
                                <option value="url">链接</option>
                                <option value="share">微信分享</option>
                            </select>
                        </td>
                        <td><input class="form-control" type="text" ng-model="b.color"/></td>
                        <td><input class="form-control" type="text" ng-model="b.data" ng-disabled="buttons[$index].type=='share'"/></td>
                        <td><a class="btn btn-danger btn-sm" ng-click="deleteLine($index)" ng-show="$index>0">移除</a></td>
                    </tr>
                    </tbody>
                </table>
                <a class="btn btn-info btn-sm" ng-click="addLine()">添加</a>

            </div>
        </div>
    </div>

</div>
